home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 33 / Amiga Format AFCD33 (Issue 117, Dec 1998).iso / -seriously_amiga- / graphics / visualengineer / arexx / shadow.rexx < prev    next >
OS/2 REXX Batch file  |  1998-09-07  |  5KB  |  274 lines

  1. /*
  2.  
  3.    v2.20 Shadow
  4.  
  5.    Marko Seppänen
  6.    marko.seppanen@wwnet.fi
  7.  
  8. */
  9.  
  10.  
  11. address IMAGEENGINEER
  12.  
  13. Options results
  14. signal on error            /* Setup a place for errors to go */
  15.  
  16.  
  17. if arg()=0 then exit
  18. x0=arg(1)
  19.  
  20. MARK x0 PRIMARY
  21. PROJECT_INFO x0 WIDTH
  22. width=result
  23. PROJECT_INFO x0 HEIGHT
  24. height=result
  25.  
  26. 'REQUEST "What kinda shadow would you like to see?" "Transparent|Normal|Black|Cancel"'
  27. shadow=result
  28.  
  29.  
  30. select
  31.  
  32.   when shadow == 1 then do
  33.  
  34.     extra=50
  35.  
  36.     if exists("ie:alpha/purewhite.alpha") == "1" then
  37.     do
  38.       OPEN "ie:alpha/purewhite.alpha" COLOUR
  39.       colortexture=result
  40.       RESIZE colortexture width+extra height+extra TILE
  41.       colortexture2=result
  42.       MARK colortexture2 SECONDARY
  43.       CLOSE colortexture
  44.  
  45.       MARK x0 PRIMARY
  46.       MARK colortexture2 SECONDARY
  47.       COMPOSITE extra/2 extra/2 MIN
  48.       xpic=result
  49.       CLOSE colortexture2
  50.  
  51.     end
  52.     else
  53.     do
  54.       'REQUEST "Please copy purewhite.alpha to dir IE:Alpha/" "Ups, sorry!"'
  55.       exit
  56.     end
  57.  
  58.     'FORM "Shadow" "Use|Cancel"',
  59.     'INTEGER, "X Shadow",-20,20,-5,SLIDER',
  60.     'INTEGER, "Y Shadow",-20,20,-5,SLIDER'
  61.     values=result
  62.     parse var values ok x y
  63.     if ok=0 then exit
  64.  
  65.     CONVOLVE xpic "IE:Convolves/GaussianBlur5x5"
  66.     x1=result
  67.     CONVOLVE x1 "IE:Convolves/GaussianBlur5x5"
  68.     x2=result
  69.     CONVOLVE x2 "IE:Convolves/GaussianBlur5x5"
  70.     gblur=result
  71.  
  72.     CLOSE xpic
  73.     CLOSE x1
  74.     CLOSE x2
  75.  
  76.     MARK x0 PRIMARY
  77.     MARK x0 ALPHA
  78.     MARK gblur SECONDARY
  79.  
  80.     COMPOSITE x+extra/2 y+extra/2 MIN
  81.  
  82.     CLOSE gblur
  83.  
  84.   end
  85.  
  86.  
  87.  
  88.  
  89.   when shadow == 2 then do
  90.  
  91.     extra=50
  92.  
  93.     if exists("ie:alpha/purewhite.alpha") == "1" then
  94.     do
  95.       OPEN "ie:alpha/purewhite.alpha" COLOUR
  96.       colortexture=result
  97.       RESIZE colortexture width+extra height+extra TILE
  98.       colortexture2=result
  99.       MARK colortexture2 SECONDARY
  100.       CLOSE colortexture
  101.  
  102.       MARK x0 PRIMARY
  103.       MARK colortexture2 SECONDARY
  104.       COMPOSITE extra/2 extra/2 MIN
  105.       xpic=result
  106.       CLOSE colortexture2
  107.     end
  108.     else
  109.     do
  110.       'REQUEST "Please copy purewhite.alpha to dir IE:Alpha/" "Ups, sorry!"'
  111.       exit
  112.     end
  113.  
  114.     'FORM "Shadow" "Use|Cancel"',
  115.     'INTEGER, "X Shadow",-20,20,-5,SLIDER',
  116.     'INTEGER, "Y Shadow",-20,20,-5,SLIDER'
  117.     values=result
  118.     parse var values ok x y
  119.     if ok=0 then exit
  120.  
  121.     CONVOLVE xpic "IE:Convolves/GaussianBlur5x5"
  122.     x1=result
  123.     CONVOLVE x1 "IE:Convolves/GaussianBlur5x5"
  124.     x2=result
  125.     CONVOLVE x2 "IE:Convolves/GaussianBlur5x5"
  126.     gblur=result
  127.  
  128.     CLOSE xpic
  129.     CLOSE x1
  130.     CLOSE x2
  131.  
  132.     THRESHOLD x0 255
  133.     pic=result
  134.  
  135.     NEGATIVE pic
  136.     pic2=result
  137.  
  138.     CLOSE pic
  139.  
  140.     MARK pic2 PRIMARY
  141.     MARK pic2 ALPHA
  142.     MARK gblur SECONDARY
  143.  
  144.     COMPOSITE x+extra/2 y+extra/2 MAX
  145.     x4=result
  146.  
  147.     CLOSE pic2
  148.     CLOSE gblur
  149.  
  150.     MARK x0 PRIMARY
  151.     MARK x0 ALPHA
  152.     MARK x4 SECONDARY
  153.  
  154.     COMPOSITE x+extra/2 y+extra/2 MIN
  155.  
  156.     CLOSE x4
  157.  
  158.  
  159.   end
  160.  
  161.  
  162.  
  163.  
  164.   when shadow == 3 then do
  165.  
  166.     extra=50
  167.  
  168.     if exists("ie:alpha/purewhite.alpha") == "1" then
  169.     do
  170.       OPEN "ie:alpha/purewhite.alpha" COLOUR
  171.       colortexture=result
  172.       RESIZE colortexture width+extra height+extra TILE
  173.       colortexture2=result
  174.       MARK colortexture2 SECONDARY
  175.       CLOSE colortexture
  176.  
  177.       MARK x0 PRIMARY
  178.       MARK colortexture2 SECONDARY
  179.       COMPOSITE extra/2 extra/2 MIN
  180.       xpic=result
  181.       CLOSE colortexture2
  182.     end
  183.     else
  184.     do
  185.       'REQUEST "Please copy purewhite.alpha to dir IE:Alpha/" "Ups, sorry!"'
  186.       exit
  187.     end
  188.  
  189.     'FORM "Shadow" "Use|Cancel"',
  190.     'INTEGER, "X Shadow",-20,20,-5,SLIDER',
  191.     'INTEGER, "Y Shadow",-20,20,-5,SLIDER'
  192.     values=result
  193.     parse var values ok origx origy
  194.     if ok=0 then exit
  195.  
  196.     THRESHOLD xpic 255
  197.     pic=result
  198.  
  199.     CONVOLVE pic "IE:Convolves/GaussianBlur5x5"
  200.     x1=result
  201.     CONVOLVE x1 "IE:Convolves/GaussianBlur5x5"
  202.     x2=result
  203.     CONVOLVE x2 "IE:Convolves/GaussianBlur5x5"
  204.     gblur=result
  205.  
  206.     CLOSE x1
  207.     CLOSE x2
  208.  
  209.     NEGATIVE pic
  210.     pic2=result
  211.  
  212.     CLOSE pic
  213.  
  214.     MARK pic2 PRIMARY
  215.     MARK pic2 ALPHA
  216.     MARK gblur SECONDARY
  217.  
  218.     COMPOSITE origx origy MAX
  219.     x3=result
  220.  
  221.     CLOSE pic2
  222.     CLOSE gblur
  223.  
  224.     MARK x3 PRIMARY
  225.     MARK x3 ALPHA
  226.     MARK xpic SECONDARY
  227.  
  228.  
  229.       if left(origx,1)       == "-" then x=abs(origx)
  230.       else if left(origx,1) ~== "-" then x=insert("-",origx)
  231.  
  232.       if left(space(origy,0),1)       == "-" then y=abs(origy)
  233.       else if left(space(origy,0),1) ~== "-" then y=insert("-",delstr(origy,1,1))
  234.  
  235.  
  236.     COMPOSITE x y MIN
  237.  
  238.     CLOSE x3
  239.     CLOSE xpic
  240.  
  241.   end
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249. otherwise
  250.   exit
  251. end
  252.  
  253.  
  254.  
  255. exit
  256.  
  257. /*******************************************************************/
  258. /* This is where control goes when an error code is returned by IE */
  259. /* It puts up a message saying what happened and on which line     */
  260. /*******************************************************************/
  261. error:
  262. if RC=5 then do            /* Did the user just cancel us? */
  263.     IE_TO_FRONT
  264.     LAST_ERROR
  265.     'REQUEST "'||RESULT||'"'
  266.     exit
  267. end
  268. else do
  269.     IE_TO_FRONT
  270.     LAST_ERROR
  271.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  272.     exit
  273. end
  274.